.class public Lcom/ss/android/socialbase/appdownloader/e/a/e;
.super Ljava/lang/Object;
.source "PackageInfoUtils.java"


# direct methods
.method public static a(Ljava/io/File;)Landroid/content/pm/PackageInfo;
    .locals 8
    .param p0    # Ljava/io/File;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    .line 1
    :try_start_0
    new-instance v0, Ljava/util/zip/ZipFile;

    invoke-direct {v0, p0}, Ljava/util/zip/ZipFile;-><init>(Ljava/io/File;)V

    .line 2
    invoke-virtual {v0}, Ljava/util/zip/ZipFile;->entries()Ljava/util/Enumeration;

    move-result-object p0

    const/4 v1, 0x0

    move-object v2, v1

    .line 3
    :goto_0
    invoke-interface {p0}, Ljava/util/Enumeration;->hasMoreElements()Z

    move-result v3
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    const-string v4, "AndroidManifest.xml"

    if-eqz v3, :cond_1

    .line 4
    :try_start_1
    invoke-interface {p0}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Ljava/util/zip/ZipEntry;

    .line 5
    invoke-virtual {v2}, Ljava/util/zip/ZipEntry;->isDirectory()Z

    move-result v3

    if-eqz v3, :cond_0

    goto :goto_0

    .line 6
    :cond_0
    invoke-virtual {v2}, Ljava/util/zip/ZipEntry;->getName()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v4, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-nez v3, :cond_1

    goto :goto_0

    :cond_1
    if-eqz v2, :cond_9

    .line 7
    invoke-virtual {v2}, Ljava/util/zip/ZipEntry;->getName()Ljava/lang/String;

    move-result-object p0

    invoke-virtual {v4, p0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result p0

    if-eqz p0, :cond_9

    .line 8
    new-instance p0, Lcom/ss/android/socialbase/appdownloader/e/a/a;

    invoke-direct {p0}, Lcom/ss/android/socialbase/appdownloader/e/a/a;-><init>()V

    .line 9
    invoke-virtual {v0, v2}, Ljava/util/zip/ZipFile;->getInputStream(Ljava/util/zip/ZipEntry;)Ljava/io/InputStream;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/ss/android/socialbase/appdownloader/e/a/a;->a(Ljava/io/InputStream;)V

    .line 10
    :cond_2
    invoke-virtual {p0}, Lcom/ss/android/socialbase/appdownloader/e/a/a;->b()I

    move-result v0

    const/4 v2, 0x1

    if-eq v0, v2, :cond_8

    const/4 v2, 0x2

    if-ne v0, v2, :cond_2

    .line 11
    invoke-virtual {p0}, Lcom/ss/android/socialbase/appdownloader/e/a/a;->e()I

    move-result v0

    const/4 v2, 0x0

    move-object v2, v1

    move-object v3, v2

    const/4 v4, 0x0

    :goto_1
    if-eq v4, v0, :cond_6

    const-string v5, "versionName"

    .line 12
    invoke-virtual {p0, v4}, Lcom/ss/android/socialbase/appdownloader/e/a/a;->a(I)Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v5, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v5

    if-eqz v5, :cond_3

    .line 13
    invoke-static {p0, v4}, Lcom/ss/android/socialbase/appdownloader/e/a/e;->a(Lcom/ss/android/socialbase/appdownloader/e/a/a;I)Ljava/lang/String;

    move-result-object v2

    goto :goto_2

    :cond_3
    const-string v5, "versionCode"

    .line 14
    invoke-virtual {p0, v4}, Lcom/ss/android/socialbase/appdownloader/e/a/a;->a(I)Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v5, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v5

    if-eqz v5, :cond_4

    .line 15
    invoke-static {p0, v4}, Lcom/ss/android/socialbase/appdownloader/e/a/e;->a(Lcom/ss/android/socialbase/appdownloader/e/a/a;I)Ljava/lang/String;

    move-result-object v1

    goto :goto_2

    :cond_4
    const-string v5, "package"

    .line 16
    invoke-virtual {p0, v4}, Lcom/ss/android/socialbase/appdownloader/e/a/a;->a(I)Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v5, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v5

    if-eqz v5, :cond_5

    .line 17
    invoke-static {p0, v4}, Lcom/ss/android/socialbase/appdownloader/e/a/e;->a(Lcom/ss/android/socialbase/appdownloader/e/a/a;I)Ljava/lang/String;

    move-result-object v3
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    :cond_5
    :goto_2
    add-int/lit8 v4, v4, 0x1

    goto :goto_1

    :cond_6
    const-wide/16 v4, -0x1

    .line 18
    :try_start_2
    invoke-static {v1}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J

    move-result-wide v6
    :try_end_2
    .catch Lcom/ss/android/socialbase/appdownloader/e/a/c; {:try_start_2 .. :try_end_2} :catch_0
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    goto :goto_3

    :catch_0
    move-wide v6, v4

    :goto_3
    cmp-long p0, v6, v4

    if-eqz p0, :cond_7

    .line 19
    :try_start_3
    new-instance p0, Landroid/content/pm/PackageInfo;

    invoke-direct {p0}, Landroid/content/pm/PackageInfo;-><init>()V

    .line 20
    iput-object v2, p0, Landroid/content/pm/PackageInfo;->versionName:Ljava/lang/String;

    long-to-int v0, v6

    .line 21
    iput v0, p0, Landroid/content/pm/PackageInfo;->versionCode:I

    .line 22
    iput-object v3, p0, Landroid/content/pm/PackageInfo;->packageName:Ljava/lang/String;

    return-object p0

    .line 23
    :cond_7
    new-instance p0, Lcom/ss/android/socialbase/appdownloader/e/a/c;

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "versionCode\u83b7\u53d6\u5931\u8d25: "

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-direct {p0, v0}, Lcom/ss/android/socialbase/appdownloader/e/a/c;-><init>(Ljava/lang/String;)V

    throw p0

    .line 24
    :cond_8
    new-instance p0, Lcom/ss/android/socialbase/appdownloader/e/a/c;

    const-string v0, "\u5df2\u8fbe\u5230END_DOCUMENT"

    invoke-direct {p0, v0}, Lcom/ss/android/socialbase/appdownloader/e/a/c;-><init>(Ljava/lang/String;)V

    throw p0

    .line 25
    :cond_9
    new-instance p0, Lcom/ss/android/socialbase/appdownloader/e/a/c;

    const-string v0, "\u6ca1\u6709\u627e\u5230AndroidManifest.xml entry"

    invoke-direct {p0, v0}, Lcom/ss/android/socialbase/appdownloader/e/a/c;-><init>(Ljava/lang/String;)V

    throw p0
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0

    :catchall_0
    move-exception p0

    .line 26
    new-instance v0, Lcom/ss/android/socialbase/appdownloader/e/a/c;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "throwable: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p0}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p0}, Ljava/lang/Throwable;->toString()Ljava/lang/String;

    move-result-object p0

    invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p0

    invoke-direct {v0, p0}, Lcom/ss/android/socialbase/appdownloader/e/a/c;-><init>(Ljava/lang/String;)V

    goto :goto_5

    :goto_4
    throw v0

    :goto_5
    goto :goto_4
.end method

.method private static a(I)Ljava/lang/String;
    .locals 1

    ushr-int/lit8 p0, p0, 0x18

    const/4 v0, 0x1

    if-ne p0, v0, :cond_0

    const-string p0, "android:"

    return-object p0

    :cond_0
    const-string p0, ""

    return-object p0
.end method

.method private static a(Lcom/ss/android/socialbase/appdownloader/e/a/a;I)Ljava/lang/String;
    .locals 4

    .line 27
    invoke-virtual {p0, p1}, Lcom/ss/android/socialbase/appdownloader/e/a/a;->b(I)I

    move-result v0

    .line 28
    invoke-virtual {p0, p1}, Lcom/ss/android/socialbase/appdownloader/e/a/a;->c(I)I

    move-result v1

    const/4 v2, 0x3

    if-ne v0, v2, :cond_0

    .line 29
    invoke-virtual {p0, p1}, Lcom/ss/android/socialbase/appdownloader/e/a/a;->d(I)Ljava/lang/String;

    move-result-object p0

    return-object p0

    :cond_0
    const/4 p0, 0x1

    const/4 p1, 0x0

    const/4 v2, 0x2

    if-ne v0, v2, :cond_1

    new-array v0, v2, [Ljava/lang/Object;

    .line 30
    invoke-static {v1}, Lcom/ss/android/socialbase/appdownloader/e/a/e;->a(I)Ljava/lang/String;

    move-result-object v2

    aput-object v2, v0, p1

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object p1

    aput-object p1, v0, p0

    const-string p0, "?%s%08X"

    invoke-static {p0, v0}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object p0

    return-object p0

    :cond_1
    const/16 v3, 0x10

    if-lt v0, v3, :cond_2

    const/16 v3, 0x1f

    if-gt v0, v3, :cond_2

    .line 31
    invoke-static {v1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object p0

    return-object p0

    :cond_2
    new-array v2, v2, [Ljava/lang/Object;

    .line 32
    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    aput-object v1, v2, p1

    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object p1

    aput-object p1, v2, p0

    const-string p0, "<0x%X, type 0x%02X>"

    invoke-static {p0, v2}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object p0

    return-object p0
.end method
